﻿<%@ Page Title="" Language="C#" MasterPageFile="~/BackEnd/BackEndMasterPage.Master" AutoEventWireup="true"
    CodeBehind="InsertCity.aspx.cs" Inherits="AteneoLibri.BackEnd.InsertCity" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        Inserisci città
    </h2>
    <asp:Panel ID="pnlInsertCity" runat="server" DefaultButton="btnInsertCity">
        <h3>
            Inserisci la nuova città</h3>
        <div>
            <asp:TextBox ID="txtCity" runat="server" CssClass="StandardTextBox" Height="20px"
                ValidationGroup="vgInsertCity"></asp:TextBox>
            <div>
                <asp:RequiredFieldValidator ID="rfvCity" runat="server" ErrorMessage="* Campo obbligatorio"
                    ValidationGroup="vgInsertCity" ControlToValidate="txtCity" Display="Dynamic"
                    CssClass="failureNotification"></asp:RequiredFieldValidator>
            </div>
            Seleziona la nazione<br />
            <asp:DropDownList ID="ddlNations" runat="server" CssClass="StandardTextBox" DataTextField="Description"
                DataValueField="IdNation" ValidationGroup="vgInsertCity">
            </asp:DropDownList>
            <br /><br />
            <asp:Button ID="btnInsertCity" runat="server" CssClass="StandardButton" Text="Inserisci"
                OnClick="btnInsertCity_Click" ValidationGroup="vgInsertCity" />
        </div>
    </asp:Panel>
    <div style="margin-top:20px;">
        <h3>
            Elenco delle città inserite</h3>
        <asp:Panel ID="pnlCities" runat="server">
            <asp:GridView ID="gvCities" runat="server" EmptyDataText="Non ci sono città presenti nel database"
                AlternatingRowStyle-BackColor="#cccccc" BackColor="#ffffff" CellPadding="2" AutoGenerateColumns="false"
                ShowFooter="true" DataKeyNames="IdCity" PageSize="15" EmptyDataRowStyle-ForeColor="Red">
                <Columns>
                    <asp:BoundField HeaderText="Città" ReadOnly="true" DataField="Description" ItemStyle-Width="200px" />
                    <asp:TemplateField>
                        <HeaderTemplate>
                            <asp:Label ID="Label1" runat="server" Text="Nazione"></asp:Label>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblNation" runat="server" Text='<%# Bind("Nation") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:ImageButton ID="btnDeleteNation" runat="server" CssClass="metroButton" AlternateText="Cancella la città"
                                ImageUrl="~/Images/deleteIcon.png" OnClick="btnDeleteCity_Click" CommandArgument='<%# Eval("IdCity") %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </asp:Panel>
    </div>
</asp:Content>
